package com.bugk;

import com.bugk.aop.CglibProxyDemo;
import com.bugk.api.DynamicProxyDemoService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

//@Configuration
//@ComponentScan(basePackages = "com.bugk")
public class SpringDemo {

	public static void main(String[] args) {
		//配置文件启动
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring-context.xml");

		//注解方式启动
//		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(SpringDemo.class);

		CglibProxyDemo cglibProxyDemo = (CglibProxyDemo) applicationContext.getBean("cglibProxyDemo");
		cglibProxyDemo.CglibProxyDemoMethod();
		DynamicProxyDemoService dynamicProxyDemoService = (DynamicProxyDemoService) applicationContext.getBean("dynamicProxyDemoService");
		dynamicProxyDemoService.dynamicProxyMethod();
	}
}
